package userInterface;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.border.EmptyBorder;

import controller.Controller;

public class MainFrame extends JFrame {
	private Controller controller;
	private JPanel contentPane;
	private JTabbedPane consolePane;
	private HomePanel home;
	private SearchandRankPanel searchandRankPanel;
	private RecommendPanel recommendPanel;
	private LogoutPanel logoutPanel;
	
	
	
	/**
	 * Create the frame.
	 */
	
	public MainFrame(Controller controller) {
		this.controller = controller;
		this.consolePane = new JTabbedPane();
		this.home = new HomePanel(controller);
		this.searchandRankPanel = new SearchandRankPanel(controller);
		this.recommendPanel = new RecommendPanel(controller);
		this.logoutPanel = new LogoutPanel(this);
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 724, 364);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		contentPane.setLayout(new BorderLayout(0, 0));
		setContentPane(contentPane);
		
		consolePane.add("Home",home);
		home.setController(controller);
		consolePane.add("Search&Rank",searchandRankPanel);
		consolePane.add("Recommend",recommendPanel);
		consolePane.add("LogOut", logoutPanel);
		getContentPane().add(consolePane);
		
		
		
	}
	
	public void setController(Controller controller) {
		this.controller = controller;
	}

}
